﻿using System;
using System.Text;

//自定义命名空间
using DreamCube.Foundation.WMI;
using DreamCube.Foundation.Security;

namespace DreamCube.Framework.Utilities.Authorization
{
    /// <summary>
    /// 限时版（带硬件信息）
    /// </summary>
    public class ExpiryWithHardware : AuthoriseBasic
    {
        /// <summary>
        /// 生成机器信息数据
        /// </summary>
        /// <returns></returns>
        protected override Byte[] GenerateData0FileData()
        {
            String detailsTemplate = "HardDiskID:{0};CPUID:{1}";
            return Encoding.UTF8.GetBytes(String.Format(detailsTemplate,
                            WMIManager.GetHardDiskSerialNumber(),
                            WMIManager.GetCPUID()));
        }

        public ExpiryWithHardware(ISecurity securityObj)
            : base(securityObj)
        { }

        public override AuthoriseType AuthoriseType
        {
            get { return Authorization.AuthoriseType.IntervalWithHardware; }
        }
    }
}
